package usualclass;


import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;

public class DateDemo {
    public static void main(String[] args) {
        /*Date d1 = new Date();
        SimpleDateFormat ft = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss");
        System.out.println(ft.format(d1));
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("3s后");*/

        /*Calendar c = Calendar.getInstance();//默认是当前日期
        System.out.println(c.get(Calendar.YEAR));
        System.out.println(c.get(Calendar.MONTH) + 1);
        GregorianCalendar g1 = new GregorianCalendar();
        if(g1.isLeapYear(g1.get(Calendar.YEAR))) {
            System.out.println("当前年份是闰年");
        }else {
            System.out.println("当前年份不是闰年");
        }*/
        Calendar c1 = Calendar.getInstance();
        c1.set(2020, 2, 0);
        System.out.println(c1.get(Calendar.YEAR) +"-"
                +(c1.get(Calendar.MONTH)+1) +"-"
                +c1.get(Calendar.DATE));
    }
}
